define("view/login/login", [
  "vuex",
  "component/common/LoginForm",
  "restTemplate",
  "text!/view/login/login.html",
  "css!./view/login/login.css"
], function({ mapActions }, LoginForm, restTemplate, template) {
  // console.log(template)

  return {
    template: template,
    components: {
      LoginForm
    },
    methods: {
      ...mapActions(["handleLogin", "getUserInfo"]),
      handleSubmit({ userName, password }) {
        this.handleLogin({ userName, password }).then(res => {
          this.getUserInfo().then(res => {
            this.$router.push({
              name: "home"
            });
          });
        });
      }
    }
  };
});
